#include "link.h"

LinkCfgStruct* link_new(LinkCfgStruct* src) {
  LinkCfgStruct* self;
  self = (LinkCfgStruct*)mempool_alloc(sizeof(LinkCfgStruct));
  if (src)
    mem_cpy(self, src, sizeof(LinkCfgStruct));
  else
    mem_set(self, 0x00, sizeof(LinkCfgStruct));

  self->address = (uint8_t*)mempool_alloc(16);
  if (src) {
    if (src->address) {
      mem_cpy(self->address, src->address, 16);
    } else {
      mem_set(self->address, 0x00, 16);
    }
  }
  return self;
}
void link_del(LinkCfgStruct* self) {
  mempool_free(self->address);
  mempool_free(self);
}
